package cn.madis.ymcc.fallback;

import cn.madis.ymcc.SearchFeignClient;
import cn.madis.ymcc.doc.CourseDoc;
import cn.madis.ymcc.result.JSONResult;
import feign.hystrix.FallbackFactory;
import org.springframework.stereotype.Component;

@Component
public class SearchFeignClientFallbackFactory implements FallbackFactory<SearchFeignClient> {
    @Override
    public SearchFeignClient create(Throwable throwable) {
        return new SearchFeignClient() {
            @Override
            public JSONResult save(CourseDoc courseDoc) {
                throwable.printStackTrace();
                return JSONResult.error("save降级gggg");
            }

            @Override
            public JSONResult remove(Long courseId) {

                throwable.printStackTrace();
                return JSONResult.error("remove降级gggg");

            }
        };
    }
}
